package com.yanqu.road.entity.activity.dunhuangshiku;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description 敦煌石窟队伍信息
 * @Author cwq
 * @Data 2021/4/15 18:21
 */
@FieldTypeAnnotation(tableName = "t_c_dunhuangshiku_team_data")
public class DunHuangShiKuTeamData extends DataObject {
    @FieldTypeAnnotation(select = true, update = true)
    private long activityId;
    @FieldTypeAnnotation(select = true, update = true, desc = "分组ID")
    private int groupId;
    @FieldTypeAnnotation(update = true)
    private int teamId;
    @FieldTypeAnnotation(desc = "队长id")
    private long userId;
    @FieldTypeAnnotation(desc = "队长所在区服id")
    private long userServerId;
    @FieldTypeAnnotation(desc = "队伍名称")
    private String name = "";
    @FieldTypeAnnotation(desc = "队伍创建时间")
    private long createTime;
    @FieldTypeAnnotation(desc = "队伍最后一次分数变动时间")
    private long updateScoreTime;
    @FieldTypeAnnotation(desc = "是否解散")
    private boolean isDelete;
    @FieldTypeAnnotation(desc = "当前完成到的壁画id")
    private int curFinishMuralId;
    @FieldTypeAnnotation(desc = "壁画上色情况 <壁画id,上色情况>")
    private Map<Integer, DunHuangShiKuMuralInfo> muralInfoMap = new ConcurrentHashMap<>();

    public DunHuangShiKuTeamData() {}

    public DunHuangShiKuTeamData(int activityId, int groupId, int teamId) {
        this.activityId = activityId;
        this.groupId = groupId;
        this.teamId = teamId;
        setInsertOption();
    }

    public void setActivityId(long activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }

    }

    public void setGroupIdId(int groupId) {
        this.groupId = groupId;
    }

    public void setTeamId(int teamId) {
        if (this.teamId != teamId) {
            this.teamId = teamId;
            setOp(DataStatus.Update);
        }

    }
    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }

    }
    public void setUserServerId(long userServerId) {
        if (this.userServerId != userServerId) {
            this.userServerId = userServerId;
            setOp(DataStatus.Update);
        }

    }
    public void setName(String name) {
        if(null == name){
            return;
        }
        if(!Objects.equals(this.name, name)) {
            this.name = name;
            setUpdateOption();
        }
    } public void setCreateTime(long createTime) {
        if (this.createTime != createTime) {
            this.createTime = createTime;
            setOp(DataStatus.Update);
        }
    }

    public void setUpdateScoreTime(long updateScoreTime) {
        if (this.updateScoreTime != updateScoreTime) {
            this.updateScoreTime = updateScoreTime;
            setOp(DataStatus.Update);
        }
    }


    public void setIsDelete(boolean isDelete) {
        if (this.isDelete != isDelete) {
            this.isDelete = isDelete;
            setOp(DataStatus.Update);
        }

    }
    public void setCurFinishMuralId(int curFinishMuralId) {
        if (this.curFinishMuralId != curFinishMuralId) {
            this.curFinishMuralId = curFinishMuralId;
            setOp(DataStatus.Update);
        }

    }

    public void setMuralInfoMap(Map<Integer, DunHuangShiKuMuralInfo> muralInfoMap) {
        this.muralInfoMap = muralInfoMap;
        setOp(DataStatus.Update);
    }

    public long getUpdateScoreTime() {
        return updateScoreTime;
    }

    public long getActivityId() {
        return activityId;
    }

    public int getGroupId() {
        return groupId;
    }

    public int getTeamId() {
        return teamId;
    }

    public long getUserId() {
        return userId;
    }

    public long getUserServerId() {
        return userServerId;
    }

    public String getName() {
        return name;
    }

    public long getCreateTime() {
        return createTime;
    }

    public boolean isDelete() {
        return isDelete;
    }

    public int getCurFinishMuralId() {
        return curFinishMuralId;
    }

    public Map<Integer, DunHuangShiKuMuralInfo> getMuralInfoMap() {
        return muralInfoMap;
    }

}
